package com.idp.system.controller;

import com.idp.common.base.BaseController;
import com.idp.common.model.PageModel;
import com.idp.common.model.ResultModel;
import com.idp.system.dto.SysLogDto;
import com.idp.system.dto.SysLogSearchDto;
import com.idp.system.service.SysLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 系统日志Controller
 * @author King
 */
@Api(tags="日志服务")
@RestController
@RequestMapping("/log/")
public class SysLogController extends BaseController {

	@Autowired
	private SysLogService sysLogService;

	/**
	 * 分页查询
	 * @param sysLogSearchDto
	 * @return
	 */
	@ApiOperation("分页查询")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "page", value = "页数", paramType = "query", required = true, defaultValue = "1"),
			@ApiImplicitParam(name = "rows", value = "每页行数", paramType = "query", required = true, defaultValue = "10")
	})
	@PostMapping("findByPage")
	public ResultModel<PageModel<SysLogDto>> findByPage(@RequestBody SysLogSearchDto sysLogSearchDto) {
		return ResultModel.success(sysLogService.findByPage(sysLogSearchDto));
	}

}
